<?php
namespace Home\Model;
use Think\Model;

class UsersModel extends Model {

    public $_validate = array(
        array('uid', 'number', '用户ID不能为空', self::MUST_VALIDATE,'', self::MODEL_UPDATE),
        array('userName','require','用户名不能为空', self::EXISTS_VALIDATE),
        array('userName','/^[\S]{4,30}$/','用户名长度要求4-12位，不限制类型',self::EXISTS_VALIDATE,'regex',3),
        array('userName','require','用户名已经存在',0,'unique',1),
        array('password','require','密码不能为空',self::MUST_VALIDATE),
        array('password', '/^[\S]{6,12}$/', '密码长度要求6-12位，不限制类型', self::MUST_VALIDATE),
        array('phoneNumber','require','手机号码不能为空',self::MUST_VALIDATE),
        array('phoneNumber','/^1[3|4|5|7|8][0-9]{9}$/','您的手机号码格式有误！',self::EXISTS_VALIDATE,'regex',3),
        array('phoneNumber','require','手机号码已经存在',0,'unique',1),
        array('email','require','邮箱不能为空', self::EXISTS_VALIDATE),
        array('email','/^(\w)+(\.\w+)*@(\w)+((\.\w+)+)$/','邮箱格式错误',self::EXISTS_VALIDATE,'regex',3),
        array('photo','require','头像不能为空', self::MUST_VALIDATE,'', self::MODEL_UPDATE)
        
    );
    
    public $_auto = array(
        array('create_time', 'format_time', self::MODEL_INSERT, 'function'),
    );
}